import Request from '@/libs/request'
import qs from 'qs'

/**查询个人设置所有信息 */
export const uSelectWebUserInfo = (data: { userId: string }) =>
  Request.get<User.Info>('/user/uSelectWebUserInfo', data)

/**用户修改公司名称 */
export const uEditUserCompany = (data: { userId: number; userCompany: string }) =>
  Request.get<null>('/user/uEditUserCompany', data)

/**用户修改邮箱 */
export const uEditMyEmail = (data: { userId: string; userEmail: string }) =>
  Request.get<null>('/user/uEditMyEmail', data)

/**用户修改昵称 */
export const uEditUserNearName = (data: { userId: number; userNearName: string }) =>
  Request.get<null>('/user/uEditUserNearName', data)

/**用户修改绑定手机号 */
export const uEditUserPhone = (data: { userId: number; newUserPhone: string; verfiyCode: string }) =>
  Request.get<null>('/user/uEditUserPhone', data)


/* 用户修改密码 */
export const uEditUserPassword = (data: { userId: number; userOldPassword: string, userNewPassword: string }) => {
  return Request.post<null>('/user/editUserPass', qs.stringify({
    userId: data.userId,
    userPass: data.userOldPassword,
    newUserPass: data.userNewPassword
  }))
}